<?php
/**
 * The html template file of index method of index module of zentaoPHP.
 *
 * The author disclaims copyright to this source code.  In place of
 * a legal notice, here is a blessing:
 *
 *  May you do good and not evil.
 *  May you find forgiveness for yourself and forgive others.
 *  May you share freely, never taking more than you give.
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php
css::import($jsRoot . 'jquery/chosen/chosen.min.css');
js::import($jsRoot . 'jquery/chosen/chosen.min.js');
?>
<div class='with-side'>
    <div class='side1'>
        <nav class='menu leftmenu affix'>
            <ul class='nav nav-primary'>
                <li><?php echo html::a($this->createLink('setting', 'setadmin'),$lang->setting->setadmin) ;?></li>
                <li><?php echo html::a($this->createLink('setting', 'index'),$lang->setting->index) ;?></li>
                <li><?php echo html::a($this->createLink('setting', 'setaudit'),$lang->setting->setaudit) ;?></li>
                <li class="active"><?php echo html::a($this->createLink('setting', 'setlink'),$lang->setting->setlink) ;?></li>
                <li><?php echo html::a($this->createLink('setting', 'setbanner'),$lang->setting->setbanner) ;?></li>
                <li><?php echo html::a($this->createLink('setting', 'setvideo'),$lang->setting->setvideo) ;?></li>
            </ul>
        </nav>
    </div>
    <div class='main'>
        <form method="post" id="ajaxForm">
            <div class="panel">
                <div class="panel-heading">
                    <strong><?php echo $lang->setting->setlink;?></strong>
                </div>
                <table class="table table-condensed">
                    <tbody><tr>
                        <th class="w-100px text-center"><?php echo $lang->setting->sort;?></th>
                        <th class="w-500px"><?php echo $lang->setting->link;?></th>
                        <th></th>
                    </tr>
            <?php if(!$links) :?>
                    <tr class="text-center">
                        <td class="text-middle">
                            <input type="text" value="" name="sort[]" class="form-control" placeholder="<?php echo $lang->setting->int;?>">
                        </td>
                        <td>
                            <div class="input-group">
                                <input type="text" name="linkname[]" id="linkname[]" value="" class="form-control" placeholder="<?php echo $lang->setting->linkname;?>">
                                <span class="input-group-addon fix-border fix-padding"></span>
                                <input type="text" name="linkurl[]" id="linkurl[]" value="" class="form-control" size="40" placeholder="<?php echo $lang->setting->linkurl;?>">
                            </div>
                        </td>
                        <td class="text-left text-middle">
                            <a href="javascript:;" class="btn btn-mini add"><i class="icon-plus"></i></a>
                        </td>
                    </tr>
                    <?php else :?>
                    <?php foreach($links as $link) :?>
                    <tr class="text-center">
                        <td class="text-middle">
                            <input type="text" value="<?php echo $link->sort?>" name="sort[]" class="form-control" placeholder="<?php echo $lang->setting->int;?>">
                        </td>
                        <td>
                            <div class="input-group">
                                <input type="text" name="linkname[]" id="linkname[]" value="<?php echo $link->linkname?>" class="form-control" placeholder="<?php echo $lang->setting->linkname;?>">
                                <span class="input-group-addon fix-border fix-padding"></span>
                                <input type="text" name="linkurl[]" id="linkurl[]" value="<?php echo $link->linkurl;?>" class="form-control" size="40" placeholder="<?php echo $lang->setting->linkurl;?>">
                            </div>
                        </td>
                        <td class="text-left text-middle">
                            <a href="javascript:;" class="btn btn-mini add"><i class="icon-plus"></i></a>
                            <a href="javascript:;" class="btn btn-mini remove"><i class="icon-remove"></i></a>
                        </td>
                    </tr>
                    <?php endforeach ?>
                    <?php endif ?>

                    </tbody><tfoot>
                    <tr>
                        <td></td>
                        <td>
                            <button type="submit" id="submit" class="btn btn-primary" data-loading="稍候...">保存</button>
                        </td>
                        <td></td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </form>
</div>
    <?php
    $placeholderK = $lang->setting->int;
    $placeholderV = $lang->setting->linkname;
    $placeholderI = $lang->setting->linkurl;
    $itemRow = <<<EOT
  <tr class='text-center'>
    <td>
      <input type='text' value="" name="sort[]" class='form-control' placeholder='{$placeholderK}'>
    </td>
    <td>
      <div class='input-group'>
        <input type='text' value="" name="values[]" class='form-control' placeholder='{$lang->setting->placeholder->value}'>
      </div>
    </td>
    <td class='text-left text-middle'>
      <a href='javascript:;' class='btn btn-mini add'><i class='icon-plus'></i></a>
      <a href='javascript:;' class='btn btn-mini remove'><i class='icon-remove'></i></a>
    </td>
  </tr>
EOT;
    ?>
    <?php js::set('itemRow', $itemRow)?>
    <?php js::set('valueplaceholder', $placeholderV)?>
    <?php js::set('infoplaceholder', $placeholderI)?>
<?php include '../../common/view/footer.html.php';?>
